// 功能: 分析用户命令, 将分析结果填充argc和argv
// 结果: 0-14为系统命令, 15为命令错误
int analyse(char *str)
{
int  i;
char temp[20];
char *ptr_char;
char  *syscmd[]={"help", "cd", "dir", "mkdir", "create", "open", "read", "write", "close", "delete", "logout", "clear","format","quit","rd","cat","\n","echo"};
argc = 0;
if(*str=='\0')
    return 16;
for(i = 0, ptr_char = str; *ptr_char != '\0'; ptr_char++)
{
if(*ptr_char != ' ')
{
while(*ptr_char != ' ' && (*ptr_char != '\0'))
temp[i++] = *ptr_char++;
argv[argc] = (char *)malloc(i+1);
strncpy(argv[argc], temp, i);
argv[argc][i] = '\0';
argc++;
i = 0;
if(*ptr_char == '\0') break;
}
}
if(argc != 0)
{
    for(i = 0; (i < 18) && strcmp(argv[0], syscmd[i]); i++);
    return i;
}
else return 18;
}
